import os
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template


from bookmarks.views import *
from bookmarks.feeds import *


site_media = os.path.join(os.path.dirname(__file__), 'site_media')

feeds = {
    'recent': RecentBookmarks,
    'user': UserBookmarks,
}



# Uncomment the next two lines to enable the admin
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Example:
    (r'^$', include('django_bookmarks.bookmarks.urls')),

    # Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
    # to INSTALLED_APPS to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    # (r'^admin/(.*)', admin.site.root),
    (r'^login/$', 'django.contrib.auth.views.login'),
)

urlpatterns = patterns('',
    #Browsing
    (r'^$', main_page),
    (r'^tag/([^\s]+)/$', tag_page),
    (r'^tag/$', tag_cloud_page),
    (r'^user/(\w+)/$', user_page),
    (r'^search/$', search_page),
    (r'^bookmark/(\d+)/$', bookmark_page),
    (r'^popular/$', popular_page),

    # Friends 
    (r'^friends/(\w+)/$', friends_page),
    (r'^friend/add/$', friend_add),

    #session management
    (r'^login/$', 'django.contrib.auth.views.login'),
    (r'^logout/$', logout_page),
    (r'^register/$', register_page),
    (r'^register/success/$', direct_to_template,{'template': 'registration/register_success.html'}),

    #account management
    (r'^save/$', bookmark_save_page),
    (r'^vote/$', bookmark_vote_page),

    # Comments
    (r'^comments/', include('django.contrib.comments.urls')),
    #

    # Feeds
    (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', { 'feed_dict': feeds }),

    

    #sitemedia
    #(r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': site_media}),

    (r'^admin/(.*)', admin.site.root),
) 
